import request from '@/utils/request'

// 查询报警日志列表
export function listLog(query) {
  return request({
    url: '/business/alarmlog/list',
    method: 'get',
    params: query
  })
}

// 获取设备未关闭的报警详情
export function deviceLog(id) {
  return request({
    url: '/business/alarmlog/listByDeviceId/' + id,
    method: 'get'
  })
}

// 按月份统计最近12个月的报警次数
export function stasticAlarmByMonth(id) {
  return request({
    url: '/business/alarmlog/stasticAlarmByMonth',
    method: 'get'
  })
}

// 获取固定数量的设备报警数据
export function listLogNum(num) {
  return request({
    url: '/business/alarmlog/listByNum/' + num,
    method: 'get'
  })
}

// 查询报警日志详细
export function getLog(id) {
  return request({
    url: '/business/alarmlog/' + id,
    method: 'get'
  })
}

// 新增报警日志
export function addLog(data) {
  return request({
    url: '/business/alarmlog',
    method: 'post',
    data: data
  })
}

// 修改报警日志
export function updateLog(data) {
  return request({
    url: '/business/alarmlog',
    method: 'put',
    data: data
  })
}

// 删除报警日志
export function delLog(id) {
  return request({
    url: '/business/alarmlog/' + id,
    method: 'delete'
  })
}

// 删除报警日志
export function getByDeviceId(deviceId) {
  return request({
    url: '/business/deviceAlarmlog/' + id,
    method: 'get'
  })
}

// 导出报警日志
export function exportLog(query) {
  return request({
    url: '/business/alarmlog/export',
    method: 'get',
    params: query
  })
}